package com.oauth.facebook.server.conf;

import java.util.EnumSet;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.oauth.facebook.server.service.FacebookGlobalService;
import com.oauth.service.application.registry.beans.ApplicationInfoBean;
import com.oauth.service.global.ApplicationGlobalService;
import com.oauth.service.global.beans.GlobalDataType;

@Component
@Qualifier("applicationInfoBean")
public class FacebookInfoBean implements ApplicationInfoBean {

	@Value("${facebook.key}")
	private Long mKey;

	@Value("${facebook.name}")
	private String mName;

	@Value("${facebook.global.datatypes}")
	private String globalDataTypes;

	@Autowired
	private FacebookGlobalService facebookGlobalService;

	public EnumSet<GlobalDataType> getGlobalDataType() {
		return globalDataTypes == null ? null : GlobalDataType.getEnumSetByName(globalDataTypes);
	}

	@Override
	public ApplicationGlobalService getAppGlobalService() {
		return facebookGlobalService;
	}

	@Override
	public Long getKey() {
		return mKey;
	}

	@Override
	public String getName() {
		return mName;
	}

}
